package org.upt.dcda.db;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * The persistent class for the orderitems database table.
 * 
 */
@Entity
@Table(name = "orderitems")
public class OrderItemEntity implements Serializable
{

	private static final long	serialVersionUID	= 1L;

	private int					orderitemsId;

	private int					orderitemsQuantity;

	private BookEntity			book;

	private OrderEntity			order;

	public OrderItemEntity()
	{
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "orderitems_id")
	public int getOrderitemsId()
	{
		return this.orderitemsId;
	}

	public void setOrderitemsId(int orderitemsId)
	{
		this.orderitemsId = orderitemsId;
	}

	@Column(name = "orderitems_quantity")
	public int getOrderitemsQuantity()
	{
		return this.orderitemsQuantity;
	}

	public void setOrderitemsQuantity(int orderitemsQuantity)
	{
		this.orderitemsQuantity = orderitemsQuantity;
	}

	// bi-directional many-to-one association to BookEntity
	@ManyToOne(cascade = CascadeType.REMOVE)
	@JoinColumn(name = "orderitems_book_id")
	public BookEntity getBook()
	{
		return this.book;
	}

	public void setBook(BookEntity book)
	{
		this.book = book;
	}

	// bi-directional many-to-one association to OrderEntity
	@ManyToOne(cascade = { CascadeType.REMOVE, CascadeType.PERSIST })
	@JoinColumn(name = "orderitems_order_id")
	public OrderEntity getOrder()
	{
		return this.order;
	}

	public void setOrder(OrderEntity order)
	{
		this.order = order;
	}

}
